RFC2229 Add missing edge case#87996
Merged
bors merged 2 commits intorust-lang:masterfrom Aug 20, 2021
Merged
Conversation
Contributor
|
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
arora-aman
reviewed
Aug 13, 2021
nikomatsakis
approved these changes
Aug 17, 2021
| } | ||
| } else { | ||
| // If it is not ty::Adt, then it should be read | ||
| needs_to_be_read = true; |
Contributor
There was a problem hiding this comment.
I am wondering what cases might be missing here -- one silly example might be matching on a constant of type () or something like that, which is kind of a no-op.
Contributor
Author
There was a problem hiding this comment.
I am not too sure either. I am going to import all the match test cases that are here https://github.com/rust-lang/rust/tree/master/src/test/ui/match and then convert them into closure test cases and see if I found anything new
Contributor
|
@bors r+ We might as well land this PR in the meantime. |
Collaborator
|
📌 Commit 2e61659 has been approved by |
Member
camsteffen
added a commit
to camsteffen/rust
that referenced
this pull request
Aug 19, 2021
RFC2229 Add missing edge case Closes rust-lang#87988 This PR fixes an ICE where a match discriminant is not being read when expected. This ICE was the result of a missing edge case which assumed that if a pattern is of type `PatKind::TupleStruct(..) | PatKind::Path(..) | PatKind::Struct(..) | PatKind::Tuple(..)` then a place could only be a multi variant if the place is of type kind Adt.
Collaborator
Collaborator
|
☀️ Test successful - checks-actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #87988
This PR fixes an ICE where a match discriminant is not being read when expected. This ICE was the result of a missing edge case which assumed that if a pattern is of type
PatKind::TupleStruct(..) | PatKind::Path(..) | PatKind::Struct(..) | PatKind::Tuple(..)then a place could only be a multi variant if the place is of type kind Adt.